﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DK.Sort
{
    public class InsertionSort : ISort
    {
        public void Sort(int[] array)
        {
            for (int i = 0; i < array.Length; i++)
            {
                var index = i;
                for (int j = index; j >= 0; j--)
                {
                    if (array[index] < array[j]) 
                    {
                        ISort.Transfrom(array, index, j);
                        index--;
                    }
                }
            }
        }
    }
}
